// 导入路由类型
import type { RouteRecordRaw } from 'vue-router'
// 匹配路由

export const routes: Array<RouteRecordRaw> = [
  // 登录
  {
    path: '/login',
    component: () => import('@/views/login/index.vue')
  },
  // 值得买
  {
    path: '/deserve',
    component: () => import('@/views/deserve/index.vue')
  },
  // 商品分类1
  {
    path: '/classification',
    component: () => import('@/views/classification/index.vue')
  },
  // 商品分类2
  {
    path: '/classifications',
    component: () => import('@/views/classifications/index.vue')
  },
  // 分类
  {
    path: '/classify',
    component: () => import('@/views/classify/index.vue')
  },
  // 搜索
  {
    path: '/search',
    component: () => import('@/views/classify/search/index.vue'),
  },
  // 购物车
  {
    path: '/shoppingCart',
    component: () => import('@/views/shoppingCart/index.vue')
  },
  // 个人中心
  {
    path: '/personage',
    component: () => import('@/views/personage/index.vue')
  },
  // 详情
  {
    path: '/details',
    component: () => import('@/views/details/index.vue')
  },
  // 首页
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/views/home/index.vue'),
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index.vue')
      }
    ]
  },

  // 错误路由
  {
    path: '/404',
    component: () => import('@/views/error/404.vue')
  },

  /**
   * 定义匹配任意路由
   */
  /* 匹配任意的路由 必须最后注册 */
  {
    path: '/:pathMatch(.*)',
    name: 'Any',
    redirect: '/404',
    meta: {
      hidden: true
    }
  }
]
